// src/utils/clearStorage.ts

/**
 * 清除Redux持久化到localStorage的数据
 * 主要用于开发环境，确保Redux中的数据能正确展示
 */
export const clearReduxPersistStorage = () => {
    if (typeof window !== 'undefined') {
        // 清除所有以'persist:'开头的localStorage项
        Object.keys(localStorage)
            .filter((key) => key.startsWith('persist:'))
            .forEach((key) => localStorage.removeItem(key));

    }
};

/**
 * 清除特定的Redux持久化数据
 * @param key - 要清除的持久化键
 */
export const clearSpecificReduxPersistStorage = (key: string) => {
    if (typeof window !== 'undefined') {
        localStorage.removeItem(`persist:${key}`);
    }
};
